<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/WEB-INF/views/layouts/header.jsp"/>
<style type="text/css">
#dm-tree{ position:relative;height:500px;}
.OrgBox { clear:left; float:left; text-align:center; position:absolute; width:160px; height:75px;border:1px solid #babcc2;background:url(../images/tree_node_bg.jpg) no-repeat center top;}
.OrgBox .department{font-size:20px;color:#005aa0;font-weight:bold;padding-top:15px;}
.OrgBox .postlist{color:#666;padding-top:5px;}
.smallBox{width:120px;}
</style>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
// 网站地址
String netPath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
%>

<!--中间部分开始-->
<div class="main">
  <!-- 左侧 -->
  <jsp:include page="/WEB-INF/views/account/sidebar.jsp"/>
  <!-- /左侧 -->
  <!-- 核心内容区域 -->
	<div id="iaas_layout_content" class="rightblock">
    	<p class="shadow"></p>
    	<div class="content"><!--默认状态下引用样式ml60，展开后引用样式ml140-->
	      	<div class="mainblock">
	        	<div class="tabA">
	          		<h1>组织架构</h1>
	        	</div>
	        	<div class="zzjg">
			        <ul>
			            <li><a href="<%=basePath%>account/createDepartment"><img src="<%=basePath%>images/cj.png" width="24" height="24">创建新部门</a></li>
			        </ul>
			        <div class="clear"></div>
			     </div>
			        <!-- tree -->
		        	<div id="dm-tree"> 
			        <script language="javascript">
						var jsonArray = eval('${departmentJson}');
						if(jsonArray){
							var root = new OrgNode();
							root = createNode(jsonArray[0]);
							var OrgShows=new OrgShow(root);
							OrgShows.Top=25;
							OrgShows.Left=25;
							OrgShows.IntervalWidth=25; //间距
							OrgShows.IntervalHeight=40; //间距
							//OrgShows.ShowType=2;
							//OrgShows.BoxHeight=100;
							OrgShows.BoxTemplet="<div id=\"{Id}\" class=\"OrgBox {classname}\"><div class=\"department\">{department}</div><div class=\"postlist\">{post}</div></div>"
							OrgShows.Run()
						}	
						function createNode(json){
								var a=new OrgNode();
								a.customParam.department=json.name;
								var positions = "";
								for(var i=0;i<json.positionList.length;i++){
									positions+=json.positionList[i].name+",";
								}
								if(positions){
									positions=positions.substr(0,positions.length-1);
								}
								a.customParam.post = positions;
								for(var j=0;j<json.childDepartmentList.length;j++){
									a.Nodes.Add(createNode(json.childDepartmentList[j]));
								}
								return a;
						}
					</script>
		        </div>
	      	</div>  
    	</div>
  	</div>
</div>
<!--中间部分结束-->
<!--底部开始-->
<jsp:include page="/WEB-INF/views/layouts/footer.jsp"/>
<!--底部结束-->

</body>
</html>
